package com.dtcnet.skmvp.mvp.model;

import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;

public class BaseModel implements IModel {

    protected LifecycleOwner owner;

    @Override
    public void onCreate(@NonNull LifecycleOwner owner) {
        IModel.super.onCreate(owner);
        this.owner = owner;
    }

    @Override
    public void onDestroy(LifecycleOwner owner) {
        IModel.super.onDestroy();
        owner.getLifecycle().removeObserver(this);
        this.owner = null;
    }
}
